inherited crdServiceGroup: TcrdServiceGroup
  Left = 484
  Top = 201
  Width = 576
  Height = 427
  Caption = #1057#1086#1079#1076#1072#1085#1080#1077'/'#1080#1079#1084#1077#1085#1077#1085#1080#1077' '#1075#1088#1091#1087#1087#1099' '#1091#1089#1083#1091#1075
  OldCreateOrder = True
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited Panel1: TPanel
    Top = 373
    Width = 568
    inherited BitBtn1: TBitBtn
      Left = 361
    end
    inherited BitBtn2: TBitBtn
      Left = 463
    end
  end
  inherited ToolBar1: TToolBar
    Top = 113
    Width = 568
    Height = 0
  end
  object GroupBox1: TGroupBox [2]
    Left = 0
    Top = 0
    Width = 568
    Height = 113
    Align = alTop
    Caption = ' '#1054#1089#1085#1086#1074#1085#1099#1077' '#1089#1074#1086#1081#1089#1090#1074#1072' '
    TabOrder = 2
    object Label2: TLabel
      Left = 68
      Top = 23
      Width = 17
      Height = 13
      Alignment = taRightJustify
      Caption = #1048#1044
    end
    object Label3: TLabel
      Left = 35
      Top = 44
      Width = 50
      Height = 13
      Alignment = taRightJustify
      Caption = #1053#1072#1079#1074#1072#1085#1080#1077
    end
    object Label4: TLabel
      Left = 10
      Top = 66
      Width = 75
      Height = 13
      Alignment = taRightJustify
      Caption = #1050#1086#1088#1086#1090#1082#1086#1077' '#1085#1072#1079#1074
    end
    object Label5: TLabel
      Left = 66
      Top = 88
      Width = 19
      Height = 13
      Alignment = taRightJustify
      Caption = #1050#1086#1076
    end
    object Label8: TLabel
      Left = 169
      Top = 88
      Width = 36
      Height = 13
      Alignment = taRightJustify
      Caption = #1057#1091#1073#1082#1086#1076
    end
    object DBEditEh3: TDBEditEh
      Left = 92
      Top = 20
      Width = 69
      Height = 19
      AlwaysShowBorder = True
      Color = clInactiveCaptionText
      DataField = 'ID'
      DataSource = dscGroups
      EditButtons = <>
      Enabled = False
      Flat = True
      ReadOnly = True
      TabOrder = 0
      Visible = True
    end
    object dbeName: TDBEditEh
      Left = 92
      Top = 42
      Width = 249
      Height = 19
      AlwaysShowBorder = True
      DataField = 'NAME'
      DataSource = dscGroups
      EditButtons = <>
      Flat = True
      TabOrder = 1
      Visible = True
    end
    object dbeShortName: TDBEditEh
      Left = 92
      Top = 64
      Width = 249
      Height = 19
      AlwaysShowBorder = True
      DataField = 'SHORT_NAME'
      DataSource = dscGroups
      EditButtons = <>
      Flat = True
      TabOrder = 2
      Visible = True
    end
    object dbeGCode: TDBEditEh
      Left = 92
      Top = 86
      Width = 69
      Height = 19
      AlwaysShowBorder = True
      DataField = 'G_CODE'
      DataSource = dscGroups
      EditButtons = <>
      Flat = True
      TabOrder = 3
      Visible = True
    end
    object dbeGSubcode: TDBEditEh
      Left = 212
      Top = 86
      Width = 69
      Height = 19
      AlwaysShowBorder = True
      DataField = 'G_SUBCODE'
      DataSource = dscGroups
      EditButtons = <>
      Flat = True
      TabOrder = 4
      Visible = True
    end
  end
  object gbMeterPolit: TGroupBox [3]
    Left = 0
    Top = 113
    Width = 568
    Height = 260
    Align = alClient
    Caption = ' '#1059#1095#1077#1090#1085#1072#1103' '#1087#1086#1083#1080#1090#1080#1082#1072' '
    TabOrder = 3
    object dbgSupplierPolit: TDBGridEh
      Left = 2
      Top = 15
      Width = 564
      Height = 243
      Align = alClient
      DataGrouping.GroupLevels = <>
      DataSource = dscMeterPolit
      EditActions = [geaCutEh, geaCopyEh, geaPasteEh, geaDeleteEh, geaSelectAllEh]
      Flat = True
      FooterColor = clWindow
      FooterFont.Charset = DEFAULT_CHARSET
      FooterFont.Color = clWindowText
      FooterFont.Height = -11
      FooterFont.Name = 'MS Sans Serif'
      FooterFont.Style = []
      Options = [dgEditing, dgTitles, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]
      RowDetailPanel.Color = clBtnFace
      TabOrder = 0
      TitleFont.Charset = DEFAULT_CHARSET
      TitleFont.Color = clWindowText
      TitleFont.Height = -11
      TitleFont.Name = 'MS Sans Serif'
      TitleFont.Style = []
      UseMultiTitle = True
      VTitleMargin = 5
      Columns = <
        item
          EditButtons = <>
          FieldName = 'ID'
          Footers = <>
        end
        item
          EditButtons = <>
          FieldName = 'SUPPLIER'
          Footers = <>
          Visible = False
        end
        item
          EditButtons = <>
          FieldName = 'NAME'
          Footers = <>
          Width = 228
        end
        item
          EditButtons = <>
          FieldName = 'METERPOLIT'
          Footers = <>
          Visible = False
        end
        item
          EditButtons = <>
          FieldName = 'GROUP_ID'
          Footers = <>
          Visible = False
        end
        item
          EditButtons = <>
          FieldName = 'SUPPLIER_ID'
          Footers = <>
          Visible = False
        end
        item
          EditButtons = <>
          FieldName = 'TTT'
          Footers = <>
          Width = 214
        end>
      object RowDetailData: TRowDetailPanelControlEh
      end
    end
  end
  inherited ActionList1: TActionList
    Left = 314
    Top = 76
    inherited aSave: TAction
      OnExecute = aSaveExecute
    end
    inherited aCancel: TAction
      OnExecute = aCancelExecute
    end
  end
  object dsMeterPolit: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE RSUPPLIER_POLIT'
      'SET '
      '    METERPOLIT = :METERPOLIT'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    RSUPPLIER_POLIT'
      'WHERE'
      '        ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO RSUPPLIER_POLIT('
      '    METERPOLIT,'
      '    GROUP_ID,'
      '    SUPPLIER_ID'
      ')'
      'VALUES('
      '    :METERPOLIT,'
      '    :GROUP_ID,'
      '    :SUPPLIER_ID'
      ')')
    RefreshSQL.Strings = (
      
        'select sp.id, vs.id as supplier, vs.name, sp.meterpolit, sp.grou' +
        'p_id, sp.supplier_id'
      'from v_supplier vs'
      
        ' left join rsupplier_polit sp on sp.supplier_id = vs.id and sp.g' +
        'roup_id = :group_id'
      ''
      ' WHERE '
      '        SP.ID = :OLD_ID'
      '    ')
    SelectSQL.Strings = (
      
        'select sp.id, vs.id as supplier, vs.name, sp.meterpolit, sp.grou' +
        'p_id, sp.supplier_id'
      'from v_supplier vs'
      
        ' left join rsupplier_polit sp on sp.supplier_id = vs.id and sp.g' +
        'roup_id = :group_id')
    BeforePost = dsMeterPolitBeforePost
    Transaction = trRefer
    Database = MAINDM.pMainDatabase
    Left = 184
    Top = 177
    oRefreshAfterPost = False
    object dsMeterPolitID: TFIBIntegerField
      DisplayLabel = #1048#1044
      FieldName = 'ID'
    end
    object dsMeterPolitSUPPLIER: TFIBIntegerField
      FieldName = 'SUPPLIER'
    end
    object dsMeterPolitNAME: TFIBStringField
      DisplayLabel = #1055#1086#1089#1090#1072#1074#1097#1080#1082
      FieldName = 'NAME'
      Size = 60
      EmptyStrToNull = True
    end
    object dsMeterPolitMETERPOLIT: TFIBSmallIntField
      FieldName = 'METERPOLIT'
    end
    object dsMeterPolitGROUP_ID: TFIBIntegerField
      FieldName = 'GROUP_ID'
    end
    object dsMeterPolitSUPPLIER_ID: TFIBIntegerField
      FieldName = 'SUPPLIER_ID'
    end
    object dsMeterPolitTTT: TStringField
      DisplayLabel = #1059#1095#1077#1090#1085#1072#1103' '#1087#1086#1083#1080#1090#1080#1082#1072
      FieldKind = fkLookup
      FieldName = 'TTT'
      LookupDataSet = dsPolit
      LookupKeyFields = 'ID'
      LookupResultField = 'NAME'
      KeyFields = 'METERPOLIT'
      Size = 30
      Lookup = True
    end
  end
  object dscMeterPolit: TDataSource
    DataSet = dsMeterPolit
    Left = 216
    Top = 177
  end
  object dsPolit: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE RSUPPLIER_POLIT'
      'SET '
      '    METERPOLIT = :METERPOLIT,'
      '    GROUP_ID = :GROUP_ID,'
      '    SUPPLIER_ID = :SUPPLIER_ID'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    RSUPPLIER_POLIT'
      'WHERE'
      '        ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO RSUPPLIER_POLIT('
      '    METERPOLIT,'
      '    GROUP_ID,'
      '    SUPPLIER_ID'
      ')'
      'VALUES('
      '    :METERPOLIT,'
      '    :GROUP_ID,'
      '    :SUPPLIER_ID'
      ')')
    RefreshSQL.Strings = (
      
        'select sp.id, vs.id as supplier, vs.name, sp.meterpolit, sp.grou' +
        'p_id, sp.supplier_id'
      'from v_supplier vs'
      
        ' left join rsupplier_polit sp on sp.supplier_id = vs.id and sp.g' +
        'roup_id = :group_id'
      ' WHERE '
      '        SP.ID = :OLD_ID'
      '    ')
    SelectSQL.Strings = (
      
        'select cast(0 as integer) as id, cast('#39#1057#1072#1083#1100#1076#1086' '#1085#1077' '#1074#1077#1076#1077#1090#1089#1103#39' as var' +
        'char(32))as name'
      'from rdb$database'
      'union'
      
        'select cast(1 as integer) as id, cast('#39#1057#1072#1083#1100#1076#1086' '#1074' '#1088#1091#1073#1083#1103#1093#39' as varch' +
        'ar(32))as name'
      'from rdb$database'
      'union'
      
        'select cast(-1 as integer) as id, cast('#39#1057#1072#1083#1100#1076#1086' '#1074' '#1077#1076'. '#1091#1089#1083#1091#1075#1080#39' as ' +
        'varchar(32))as name'
      'from rdb$database')
    Transaction = trRefer
    Database = MAINDM.pMainDatabase
    Left = 184
    Top = 205
    object dsPolitID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsPolitNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 32
      EmptyStrToNull = True
    end
  end
  object dscPolit: TDataSource
    DataSet = dsPolit
    Left = 216
    Top = 205
  end
  object dsGroups: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE SERVICES'
      'SET '
      '    G_CODE = :G_CODE,'
      '    G_SUBCODE = :G_SUBCODE,'
      '    NAME = :NAME,'
      '    SHORT_NAME = :SHORT_NAME'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    SERVICES'
      'WHERE'
      '        ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO SERVICES('
      '    G_CODE,'
      '    G_SUBCODE,'
      '    NAME,'
      '    SHORT_NAME,'
      '    GROUP_ID,'
      '    CALCTYPE'
      ')'
      'VALUES('
      '    :G_CODE,'
      '    :G_SUBCODE,'
      '    :NAME,'
      '    :SHORT_NAME,'
      '    0,'
      '    0'
      ')'
      'returning id')
    RefreshSQL.Strings = (
      'select s.id, s.g_code, s.g_subcode, '
      's.name, s.short_name'
      'from services s'
      'where(  s.group_id = 0'
      '     ) and (     S.ID = :OLD_ID'
      '     )'
      '    ')
    SelectSQL.Strings = (
      'select s.id, s.g_code, s.g_subcode, '
      '       s.name, s.short_name'
      '  from services s'
      '  where s.group_id = 0'
      '    and s.id = :pgroup_id')
    Transaction = trRefer
    Database = MAINDM.pMainDatabase
    Left = 500
    Top = 14
    oFetchAll = True
    object dsGroupsID: TFIBIntegerField
      DisplayLabel = #1048#1044
      FieldName = 'ID'
    end
    object dsGroupsG_CODE: TFIBIntegerField
      FieldName = 'G_CODE'
    end
    object dsGroupsG_SUBCODE: TFIBIntegerField
      FieldName = 'G_SUBCODE'
    end
    object dsGroupsNAME: TFIBStringField
      DisplayLabel = #1053#1072#1079#1074#1072#1085#1080#1077' '#1075#1088#1091#1087#1087#1099
      FieldName = 'NAME'
      Size = 120
      EmptyStrToNull = True
    end
    object dsGroupsSHORT_NAME: TFIBStringField
      DisplayLabel = #1050#1086#1088#1086#1090#1082#1086#1077' '#1085#1072#1079#1074#1072#1085#1080#1077
      FieldName = 'SHORT_NAME'
      Size = 16
      EmptyStrToNull = True
    end
  end
  object dscGroups: TDataSource
    DataSet = dsGroups
    Left = 530
    Top = 14
  end
  object trRefer: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 500
    Top = 42
  end
end
